home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / pc / pr42sdk / examples / headers / premiere.h < prev   
C/C++ Source or Header  |  1996-03-28  |  32KB  |  882 lines

  1. //=============================================================================
  2. //
  3. // Premiere.h
  4. //
  5. // Part of the Adobe Premiere 4.2 Plug-in Developer's Toolkit.
  6. //
  7. // Copyright 1993-96, Adobe Systems Incorporated, all rights reserved worldwide.
  8. //
  9. //-----------------------------------------------------------------------------
  10.  
  11. // Microsoft is checking for the window class from 16-bit Premiere
  12. // ("DemonMain"), and turning off DirectVideo if it finds it.
  13.  
  14. #define    PREMWNDCLASS    "DemonMain32"
  15.  
  16.  
  17. // ---------------------------------------------------------------------
  18. // Basic types
  19.  
  20. typedef char *Ptr;
  21. typedef Ptr *Handle;        /*  pointer to a master pointer */
  22.  
  23. typedef long Fixed;            /* fixed point arithmatic type */
  24.  
  25. typedef unsigned char Boolean;
  26.  
  27. typedef long (*ProcPtr)();
  28. typedef ProcPtr *ProcHandle;
  29.  
  30. typedef unsigned char Str255[256],Str63[64],Str32[33],Str31[32],Str27[28],Str15[16],*StringPtr,**StringHandle;
  31.  
  32. typedef const unsigned char *ConstStr255Param;
  33. typedef ConstStr255Param ConstStr63Param,ConstStr32Param,ConstStr31Param,
  34.            ConstStr27Param,ConstStr15Param;
  35.  
  36. typedef short OSErr;        /* error code */
  37. typedef unsigned long OSType;
  38. typedef OSType *OSTypePtr;
  39. typedef unsigned long ResType;
  40. typedef ResType *ResTypePtr;
  41. typedef unsigned char Style;
  42.  
  43.  
  44. // ---------------------------------------------------------------------
  45. // preprocessor macros
  46.  
  47. #ifdef pascal
  48. #undef pascal
  49. #endif
  50. #define pascal
  51.  
  52. #ifndef NULL
  53. #define NULL 0
  54. #endif
  55. #define nil 0
  56.  
  57. #define noErr 0            /*All is well*/
  58.  
  59. #ifndef false
  60. #define false 0
  61. #endif
  62. #ifndef true
  63. #define true 1
  64. #endif
  65.  
  66.  
  67.  
  68.  
  69. // ---------------------------------------------------------------------
  70. // basic structures
  71. // ---------------------------------------------------------------------
  72.  
  73. // Special long word based rect and point
  74.  
  75. typedef struct {
  76.     long            top;
  77.     long            left;
  78.     long            bottom;
  79.     long            right;
  80. } LongRect;
  81.  
  82. typedef struct {
  83.     long            y;
  84.     long            x;
  85. } LongPoint;
  86.  
  87.  
  88. // File spec record
  89.  
  90. struct FSSpec {
  91.  short vRefNum;
  92.  long parID;
  93.  char    name[_MAX_PATH];
  94. };
  95. typedef struct FSSpec FSSpec;
  96. typedef FSSpec *FSSpecPtr, **FSSpecHandle;
  97.  
  98.  
  99. // video frame record, 32 bits/pixel
  100. // All internal buffers are in this format
  101. //
  102. // Pixel buffer pointed to by *pix is same as a DIB buffer:
  103. // BGRA, origin at lower left.
  104. //
  105. // 4.2 changes -- njs
  106.  
  107. typedef struct
  108. {
  109.     RECT            bounds;            // bounds of pixmap
  110.     int                rowbytes;        // rowbytes of data
  111.     int                bitsperpixel;    // bits per pixels. in 4.2 or earlier, always 32
  112.     int                pixelformat;    // storage format. Future expansion. In 4.2 or earlier, always 0 (RGB)
  113.     char            *pix;            // pointer to pixel buffer
  114.     long            reserved[4];
  115. } PPix, *PPixPtr, **PPixHand;
  116.  
  117. /*
  118. typedef struct
  119. {
  120.     DWORD            size;                // size of header+pix
  121.     RECT            bounds;            // bounds of pixmap
  122.     short            rowbytes;        // rowbytes of BGRA data
  123.     short            unused;            // padding so struct is 16 bytes
  124.     char            data[1];            // data follows: BGRA
  125. } PPix, *PPixPtr, **PPixHand;
  126. // == 16(+1) bytes
  127. */
  128.  
  129. typedef    short    PWorldID;    
  130.  
  131.  
  132. // ---------------------------------------------------------------------
  133. // Replaceable Bottleneck routines and definitions
  134. // ---------------------------------------------------------------------
  135.  
  136. typedef void (*StretchBitsPtr)(PPixPtr srcPix, PPixPtr dstPix, LPRECT srcRect,
  137.                                                 LPRECT dstRect, short mode, HANDLE rgn);
  138. typedef void (*AudStretchPtr)(Ptr src, long srclen, Ptr dest, long destlen, UINT flags);
  139. typedef void (*AudMixPtr)(Ptr buf1, long v1, Ptr buf2, long v2, Ptr buf3, long v3,
  140.                                                                     long width, Ptr dest, UINT flags);
  141. typedef void (*AudLimitPtr)(Ptr src, Ptr dest, long width, UINT flags, long total);
  142. typedef void (*AudSumPtr)(Ptr src, Ptr dest, long width, long scale, UINT flags, long part, long total);
  143. typedef void (*DistortPolygonPtr)(PPixHand src, PPixHand dest, RECT *srcbox, Point *dstpts);
  144. typedef void (*DistortFixedPolygonPtr)(PPixHand src, PPixHand dest, RECT *srcbox, LongPoint *dstpts);
  145. typedef void (*PolyToPolyPtr)(PPixHand src, PPixHand dest, Point *srcpts, Point *dstpts);
  146. typedef void (*FixedToFixedPtr)(PPixHand src, PPixHand dest, LongPoint *srcpts, LongPoint *dstpts);
  147. typedef void (*ImageKeyPtr)(PPixHand src, PPixHand dest, PPixHand work,
  148.                                             Ptr workbuf, unsigned short level, void *therec);
  149.  
  150. typedef struct {
  151.     short                                count;                    // number of routines
  152.     short                                reserved[14];
  153.     StretchBitsPtr                    StretchBits;
  154.     DistortPolygonPtr                DistortPolygon;
  155.     PolyToPolyPtr                    MapPolygon;
  156.     AudStretchPtr                    AudioStretch;
  157.     AudMixPtr                        AudioMix;
  158.     AudSumPtr                        AudioSum;
  159.     AudLimitPtr                        AudioLimit;
  160.     DistortFixedPolygonPtr            DistortFixed;
  161.     FixedToFixedPtr                    FixedToFixed;
  162.     ImageKeyPtr                        ImageKey;
  163.     long                            unused[3];
  164. } BottleRec;
  165.  
  166. enum {
  167.     bnReplace = 0
  168. };
  169.  
  170. typedef void (*BottleProc)(short selector, BottleRec *therec);
  171.  
  172. // modes for StretchBits bottleneck
  173.  
  174. #define cbBlend    0x8000
  175. #define cbInterp    0x4000
  176. #define cbMaskHdl    0x2000
  177.  
  178.  
  179. typedef struct {
  180.     Ptr            srcPtr;                    // Pointer to total source block
  181.     long        srcSampleOffset;        // Offset to important part of source (in samps)
  182.     long        srcTotalSampleCount;    // Total samples in source block
  183.     long        srcSampleCount;            // Len of this part of source block (in samples)
  184.     short        srcFlags;                // Format of source block
  185.     Ptr            dstPtr;                    // Pointer to destination block
  186.     long        dstSampleCount;            // Len of destination block (in samples)
  187.     short        dstFlags;                // Format of destination block
  188.     
  189.     long        srcRate;
  190.     long        dstRate;
  191.     long        prevDstSamples;
  192.     long        prevSrcSamples;
  193. } ResampleRec;
  194.  
  195. typedef struct {
  196.     Ptr            srcPtr;
  197.     long        srcSampleCount;
  198.     short        srcFlags;
  199.     
  200.     Ptr            dstPtr;
  201.     long        dstSampleCount;
  202.     short        dstFlags;
  203.     
  204.     long        convertOffset;
  205.     long        step;
  206. } AudioMungeRec;
  207.  
  208.  
  209. // ---------------------------------------------------------------------
  210. // Transition / Filter records & types
  211. // ---------------------------------------------------------------------
  212.  
  213.  
  214. // field flags for transitions
  215.  
  216. enum {
  217.     gvHalfV            =    0x0800,
  218.     gvHalfH            =    0x0400,
  219.     gvFieldsOdd        =    0x0200,
  220.     gvFieldsEven    =    0x0100,
  221. };
  222.  
  223.  
  224. typedef short (*FXCallBackProcPtr)(long frame, short track, 
  225.                                         PPixHand thePort, RECT *theBox, Handle privateData);
  226.  
  227. // Transition Data Structure
  228.  
  229. typedef struct {
  230.     Handle                    specsHandle;
  231. //    void                    *specData;        // Filter data -- windows GlobalPtr
  232. //    int                        specsize;        // size of filter data
  233.     PPixHand                source1;        // source pixels 1
  234.     PPixHand                source2;        // source pixels 2
  235.     PPixHand                destination;    // Destination pixels
  236.     long                    part;            // part / total = % complete
  237.     long                    total;
  238.     char                    previewing;        // in preview mode?
  239.     unsigned char            arrowFlags;        // flags for direction arrows
  240.     char                    reverse;            // is effect being reversed?
  241.     char                    source;            // are sources swapped?
  242.     POINT                    start;            // starting point for effect
  243.     POINT                    end;                // ending point for effect
  244.     POINT                    center;            // the reference center point
  245.     void                    *privateData;    // Editor private data handle
  246.     FXCallBackProcPtr        callBack;        // callback, not valid if nil
  247.     BottleRec                *bottleNecks;    // botleneck callback routines
  248.     short                    version;
  249.     short                    sizeFlags;
  250.     long                    flags;
  251.     short                    fps;
  252. } EffectRecord, **EffectHandle;
  253.  
  254.  
  255. typedef struct {
  256.     EffectRecord            common;                // common fields;
  257.     BITMAPINFOHEADER        src1binfo;            // compressed source 1 description
  258.     char                    *src1data;            // compressed source 1 data
  259.     long                    src1size;            // compressed source 1 data size
  260.     BITMAPINFOHEADER        src2binfo;            // compressed source 2 description
  261.     char                    *src2data;            // compressed source 2 data
  262.     long                    src2size;            // compressed source 2 data size
  263.     BITMAPINFOHEADER        dstbinfo;            // compressed source 2 description
  264.     char                     *dstdata;             // output frame buffer
  265.     DWORD                     framesize;            // returned output frame size
  266.     long                    reqsize;             // requested data size (0 = don't care)
  267.     long                    reqquality;            // requested frame quality (0-100%)
  268. } DirectEffectRecord, **DirectHandle;
  269.  
  270.  
  271. // Selector messages
  272. enum {
  273.     esExecute = 0,
  274.     esSetup,
  275.     esAbout,
  276.     esCanHandleComp,
  277.     esProcessComp
  278. };
  279.  
  280. // Effect Corner Bits
  281. enum {
  282.     bitTop =        0x01,
  283.     bitRight =        0x02,
  284.     bitBottom =        0x04,
  285.     bitLeft =        0x08,
  286.     bitUpperRight =    0x10,
  287.     bitLowerRight =    0x20,
  288.     bitLowerLeft =    0x40,
  289.     bitUpperLeft =    0x80
  290. };
  291.  
  292.  
  293. // Filter callback prototype
  294.  
  295. typedef short (CALLBACK *VFilterCallBackProcPtr)(long frame, 
  296.                                 PPixHand thePort,RECT *theBox, Handle privateData);
  297.  
  298. typedef short (CALLBACK *AFilterCallBackProcPtr)(long sample, long count,
  299.                                                 Ptr buffer, Handle privateData);
  300.  
  301.  
  302. // Video Filter Data Structure
  303.  
  304. typedef struct {
  305.     Handle                        specsHandle;
  306. //    void                        *specData;        // Filter data -- windows GlobalPtr
  307. //    int                            specsize;        // size of filter data
  308.     PPixHand                    source;
  309.     PPixHand                    destination;
  310.     long                        part;
  311.     long                        total;
  312.     char                        previewing;
  313.     void                        *privateData;
  314.     VFilterCallBackProcPtr        callBack;
  315.     BottleRec                    *bottleNecks;
  316.     short                        version;
  317.     short                        sizeFlags;
  318.     long                        flags;
  319.     short                        fps;
  320.     long                        instanceData;        // 4.2 changes -- njs
  321. } VideoRecord, **VideoHandle;
  322.  
  323. // Audio Filter data structure
  324.  
  325. typedef struct {
  326.     Handle                        specsHandle;
  327. //    void                        *specData;        // Filter data -- windows GlobalPtr
  328. //    int                            specsize;        // size of filter data
  329.     Ptr                            source;
  330.     Ptr                            destination;
  331.     long                        samplenum;
  332.     long                        samplecount;
  333.     char                        previewing;
  334.     void                        *privateData;
  335.     AFilterCallBackProcPtr        callBack;
  336.     long                        totalsamples;
  337.     short                        flags;
  338.     long                        rate;
  339.     BottleRec                    *bottleNecks;
  340.     short                        version;
  341.     long                        extraFlags;
  342.     short                        fps;
  343.     long                        instanceData;        // 4.2 changes -- njs
  344. } AudioRecord, ** AudioFilter;
  345.  
  346. // Selector messages
  347. enum {
  348.     fsExecute = 0,
  349.     fsSetup,
  350.     fsAbout,
  351. // 4.2 changes -- njs
  352.     fsDisposeData
  353. };
  354.  
  355.  
  356. //
  357. // These are values for the FltS resource which describes the type of
  358. // storage used in a filter's parameter block.
  359. //
  360. //        fltsPhotoPtr        A global memory ptr.
  361. //        fltsPhotoPtrMac    A ptr with the first 4 bytes referencing the
  362. //                                rest of the data.
  363. //        fltsPhotoHand        A global memory handle.
  364. //        fltsPhotoHandMac    A global memory handle with the first 4 bytes
  365. //                                referencing the rest of the data.
  366. //        fltsPhotoDblPtr    A ptr to a ptr.
  367. //                                The first ptr points to an 8-byte block.
  368. //                                The last 4-bytes of the block contains the marker FOTO_SIG.
  369. //                                The first 4-bytes contains a ptr to the data.
  370. //
  371. // Use ID 1 for the FltS resource.
  372. //
  373.  
  374. #define fltsPhotoPtr        0x0001
  375. #define fltsPhotoPtrMac        0x0002
  376. #define fltsPhotoHand        0x0003
  377. #define fltsPhotoHandMac    0x0004
  378. #define fltsPhotoDblPtr        0x0005
  379.  
  380. #define FOTO_SIG            0x464f544f            // 'FOTO'
  381.  
  382. // ---------------------------------------------------------------------
  383. // Definitions for device control plug-ins
  384. // ---------------------------------------------------------------------
  385.  
  386. typedef long (*CallBackPtr)();
  387.  
  388.  
  389.  
  390. // Device control calling struct
  391.  
  392. typedef struct {
  393.     Handle                deviceData;                // private data which the plug-in creates
  394.     short                command;                // command to perform
  395.     short                mode;                    // mode command and status
  396.     long                timecode;                // timecode command and status: -1 = N/A, -2 = blank
  397.     short                timeformat;                // 0=non-drop, 1=drop-frame
  398.     short                timerate;                // fps for the timecode above
  399.     long                features;                // feature bits from the features command
  400.     short                error;                    // error code from any routine
  401.     short                preroll;                // pre-roll time (secs) for cmdLocate
  402.     CallBackPtr            callback;                // callback for cmdLocate, returns non-zero to stop
  403.     ProcPtr                PauseProc;                // callback to pause current operations
  404.     ProcPtr                ResumeProc;                // callback to restart current operations
  405.     char                reserved[256];            // reserved;
  406. } DeviceRec, **DeviceHand;
  407.  
  408.  
  409. // Calling selectors for device control
  410.  
  411. enum {
  412.     dsInit = 0,                // Create any structure(s), pick an operating mode, no dialogs here
  413.     dsSetup,                // prompt for any user dialogs
  414.     dsExecute,                // perform command
  415.     dsCleanup,                // dispose any allocated structure(s)
  416.     dsRestart,                // re-start any features, used at program startup to reconnect to device
  417. };
  418.  
  419. // Commands which plug-in can perform
  420.  
  421. enum {
  422.     cmdGetFeatures = 0,    // return feature bits
  423.     cmdStatus,            // fill in current mode and timecode, gets called repeatedly
  424.     cmdNewMode,            // change to the mode in 'mode'
  425.     cmdGoto,            // goto the timecode specified in 'timecode'
  426.     cmdLocate,            // find the timecode in 'timecode' and then return (with deck in play)
  427.     cmdShuttle,            // shuttle at rate specified in 'mode', from -100 to +100
  428.     cmdJogTo,            // position at 'timecode', quickly from the current location
  429.     cmdJog                // Jog at rate specified in 'mode', from -25 to +25 - new in 4.2
  430. };
  431.  
  432. // Feature bits
  433.  
  434. #define fStepFwd        0x8000
  435.                                 // can step forward
  436. enum {
  437.     fHasJogMode        = 0x20000,    // device has jog capabilities - new in 4.2
  438.     fStepBack        = 0x4000,    // can step back
  439.     fRecord            = 0x2000,    // can record
  440.     fPositionInfo    = 0x1000,    // returns position info
  441.     fGoto            = 0x0800,    // can seek to a specific frame (fPositionInfo must also be set)
  442.     f1_5            = 0x0400,    // can play at 1/5 speed
  443.     f1_10            = 0x0200,    // can play at 1/10 speed
  444.     fBasic            = 0x0100,    // supports Stop,Play,Pause,FastFwd,Rewind
  445.     fHasOptions        = 0x0080,    // plug-in puts up an options dialog
  446.     fReversePlay    = 0x0040,    // supports reverse play
  447.     fCanLocate        = 0x0020,    // can locate a specific timecode
  448.     fStillFrame        = 0x0010,    // device is frame addressable, like a laser disc
  449.     fCanShuttle        = 0x0008,    // supports the Shuttle command
  450.     fCanJog            = 0x0004    // supports the JogTo command
  451. };
  452.  
  453. // Mode commands/states
  454.  
  455. enum {
  456.     modeStop = 0,
  457.     modePlay,
  458.     modePlay1_5,
  459.     modePlay1_10,
  460.     modePause,
  461.     modeFastFwd,
  462.     modeRewind,
  463.     modeRecord,
  464.     modeGoto,
  465.     modeStepFwd,
  466.     modeStepBack,
  467.     modePlayRev,
  468.     modePlayRev1_5,
  469.     modePlayRev1_10
  470. };
  471.  
  472.  
  473.  
  474. // ---------------------------------------------------------------------
  475. // Utility Routines
  476. // ---------------------------------------------------------------------
  477.  
  478.  
  479. // Mac-style memory management calls
  480.  
  481. typedef long Size;          /* size of a block in bytes */
  482.  
  483. pascal Ptr NewPtr(Size byteCount);
  484. pascal void DisposPtr(Ptr p);
  485. pascal void DisposHandle(Handle h);
  486. pascal Ptr NewPtrClear(Size byteCount);
  487. pascal Handle NewHandleClear(Size byteCount);
  488. pascal Handle NewHandle(Size byteCount);
  489. pascal void SetPtrSize(Ptr FAR *p, Size newSize);
  490. pascal Size GetPtrSize(Ptr p); 
  491. pascal void HLock(Handle h);
  492. pascal void HUnlock(Handle h);
  493. pascal Size GetHandleSize(Handle h); 
  494. pascal void SetHandleSize(Handle h,Size newSize);
  495. pascal OSErr MemError(void);
  496. pascal void BlockMove(const void *srcPtr,void *destPtr,Size byteCount);
  497. pascal char HGetState(Handle h);
  498. pascal void HSetState(Handle h,char flags);
  499. pascal void HNoPurge(Handle h);
  500. pascal void MoveHHi(Handle h);
  501. pascal void HPurge(Handle h);
  502. pascal OSErr HandToHand(Handle *theHndl); 
  503. pascal OSErr PtrToHand(const void *srcPtr,Handle *dstHndl,long size); 
  504. pascal OSErr HandAndHand(Handle hand1,Handle hand2);
  505. pascal OSErr PtrAndHand(const void *ptr1,Handle hand2,long size);
  506.  
  507. #define DisposeHandle    DisposHandle
  508. #define DisposePtr        DisposPtr
  509.  
  510.  
  511. // Misc.
  512.  
  513. HWND GetMainWnd(void);        // returns Premiere's main window
  514.                             // use GetLastActivePopup(GetMainWnd())
  515.                             // for any plugin dialog parents
  516.  
  517.  
  518. // PWorld/PPix Utils
  519.  
  520. PPixHand GetPWorldBits(PWorldID pw);
  521. void PPixToScreen(PPixHand pix, HDC dc,    LPRECT drawrect, LPRECT theRect);
  522. char NewPWorld(PWorldID *pwID, LPRECT bounds);
  523. void DisposePWorld(PWorldID pw);
  524.  
  525. //-------------------------------------------------------------------------------------
  526. // Data exporter definitions
  527.  
  528.  
  529. //══════════════════════════════════════
  530. // Data Export Data Structure
  531.  
  532. enum {
  533.     aflag5KHz =            0x0001,
  534.     aflag11KHz =        0x0002,
  535.     aflag22KHz =        0x0004,
  536.     aflag44KHz =        0x0008,
  537.     aflagSpecial =        0x0040,
  538.     aflagStereo =        0x0100,
  539.     aflag16Bit =        0x0200,
  540.     aflagDropFrame =    0x0400,
  541. };
  542.  
  543. // Callback to get one frame of video
  544. typedef short (CALLBACK *GetVidCallBack)(long frame, PWorldID thePort, LPRECT theBox, LPVOID privateData);
  545.  
  546. // Callback to get one second of audio
  547. typedef short (CALLBACK *GetAudCallBack)(long second, short formatFlags, LPSTR buffer, LPVOID privateData);
  548.  
  549. typedef struct {
  550.     long                markers[12];    // clip markers
  551.     long                numframes;        // number of frames in the clip
  552.     short                framerate;        // frames per second of source material
  553.     RECT                bounds;            // the video bounding frame, empty if no video
  554.     short                audflags;        // the audio flags (above), zero if no audio
  555.     long                audrate;        // the audio rate in Hz
  556.     GetVidCallBack        getVideo;        // video reader callback
  557.     GetAudCallBack        getAudio;        // audio reader callback
  558.     Handle                privateData;    // private data passed to above routines
  559.     long                specialRate;    // special rate
  560. } DataExportRec, **DataExportHandle;
  561.  
  562. enum {
  563.     edExecute = 0,
  564. };
  565.  
  566. // Exported call to get full path of exported file.
  567.  
  568. void GetExportFilePath(DataExportHandle datahand, LPSTR path);
  569.  
  570. #define    mExpVid                0x8000        // for vid exports
  571. #define    mExpAud                0x4000        // for aud exports
  572.  
  573.  
  574. //-------------------------------------------------------------------------------------
  575. // EDL exporter definitions
  576. //-------------------------------------------------------------------------------------
  577.  
  578. // Header definition for data blocks
  579. //
  580. // Blocks passed to an export module have a header followed by any
  581. // static data, then any sub-blocks, which themselves have
  582. // headers, static data, and sub-blocks...
  583.  
  584. typedef struct {
  585.     long            size;            // total size of this block, including static data and sub-blocks
  586.     long            dataSize;        // the static data size for this block
  587.     long            type;            // the block type (basically, an OSType)
  588.     long            theID;            // the block ID, for blocks which do not need an ID, 0 is used
  589. } BlockRec;
  590.  
  591. // These are the routines used to take apart data blocks
  592.  
  593. long CountTypeBlocks(long type, BlockRec *srcBlock);
  594. BlockRec *FindBlock(long type, long theID, long index, BlockRec *srcBlock);
  595. BlockRec **GetBlock(long type, long theID, long index, BlockRec **srcBlock);
  596. void ExtractBlockData(BlockRec *srcBlock, void *destination, long *maxlen);
  597.  
  598.  
  599. // These are the track ID's
  600. enum {
  601.     tVideoA = 0,
  602.     tVideoB,
  603.     tVideoSuper,
  604.     tFX1,
  605.     tAudioA,
  606.     tAudioB,
  607.     tAudioC
  608. };
  609.  
  610. #define FOURCC( ch0, ch1, ch2, ch3 )                                \
  611.                 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) |    \
  612.                 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  613.  
  614. #define    BLOKblok FOURCC('B','L','O','K')
  615. #define    TRKBblok FOURCC('T','R','K','B')
  616. #define    TRAKblok FOURCC('T','R','A','K')
  617. #define    FVIDblok FOURCC('F','V','I','D')
  618. #define    FSUPblok FOURCC('F','S','U','P')
  619. #define    FAUDblok FOURCC('F','A','U','D')
  620. #define    AMAPblok FOURCC('A','M','A','P')
  621. #define    FF_Xblok FOURCC('F','F','_','X')
  622. #define    TRECblok FOURCC('T','R','E','C')
  623. #define    RBNDblok FOURCC('R','B','N','D')
  624. #define    RPNTblok FOURCC('R','P','N','T')
  625. #define    FXOPblok FOURCC('F','X','O','P')
  626. #define    FXDFblok FOURCC('F','X','D','F')
  627. #define    EDGEblok FOURCC('E','D','G','E')
  628. #define    MPNTblok FOURCC('M','P','N','T')
  629. #define    SPNTblok FOURCC('S','P','N','T')
  630. #define    EPNTblok FOURCC('E','P','N','T')
  631. #define    OVERblok FOURCC('O','V','E','R')
  632. #define    COLRblok FOURCC('C','O','L','R')
  633. #define    SIMIblok FOURCC('S','I','M','I')
  634. #define    BLNDblok FOURCC('B','L','N','D')
  635. #define    THRSblok FOURCC('T','H','R','S')
  636. #define    CUTOblok FOURCC('C','U','T','O')
  637. #define    ALIAblok FOURCC('A','L','I','A')
  638. #define    SHADblok FOURCC('S','H','A','D')
  639. #define    RVRSblok FOURCC('R','V','R','S')
  640. #define    GARBblok FOURCC('G','A','R','B')
  641. #define    PONTblok FOURCC('P','O','N','T')
  642. #define    MATIblok FOURCC('M','A','T','I')
  643. #define    VFLTblok FOURCC('V','F','L','T')
  644. #define    AFLTblok FOURCC('A','F','L','T')
  645. #define    FILTblok FOURCC('F','I','L','T')
  646. #define    MOTNblok FOURCC('M','O','T','N')
  647. #define    SMTHblok FOURCC('S','M','T','H')
  648. #define    MRECblok FOURCC('M','R','E','C')
  649. #define    DATAblok FOURCC('D','A','T','A')
  650. #define    CLPBblok FOURCC('C','L','P','B')
  651. #define    CLIPblok FOURCC('C','L','I','P')
  652. #define    MARKblok FOURCC('M','A','R','K')
  653. #define    LOCKblok FOURCC('L','O','C','K')
  654. #define    RATEblok FOURCC('R','A','T','E')
  655. #define    FILBblok FOURCC('F','I','L','B')
  656. #define    FILEblok FOURCC('F','I','L','E')
  657. #define    MACSblok FOURCC('M','A','C','S')
  658. #define    MACPblok FOURCC('M','A','C','P')
  659. #define    DOSFblok FOURCC('D','O','S','F')
  660. #define    FRMSblok FOURCC('F','R','M','S')
  661. #define    VIDIblok FOURCC('V','I','D','I')
  662. #define    AUDIblok FOURCC('A','U','D','I')
  663. #define    TIMCblok FOURCC('T','I','M','C')
  664. #define    TIMBblok FOURCC('T','I','M','B')
  665. #define    REELblok FOURCC('R','E','E','L')
  666.  
  667. // These are the currently defined block types
  668.  
  669. //                Type            ID            Parent        Data                                Description
  670. //                --------         ------         ----------    ----------------------------------    --------------------------------
  671. #define    bBLOK     BLOKblok        //    0        none        (L)wrk strt, (L)wrk end, sub-blks    Container for everything
  672. #define    bTRKB     TRKBblok        //    0        BLOK        track blocks                        Container for all of the tracks
  673. #define    bTRAK     TRAKblok        //    ID        TRKB        (S)flags, TREC blocks                Contains all of the blocks for an entire track
  674. #define    bFVID     FVIDblok        //    0        TRAK        none                                indicates that a track contains video records
  675. #define    bFSUP     FSUPblok        //    0        TRAK        none                                indicates that a track contains superimpose records
  676. #define    bFAUD     FAUDblok        //    0        TRAK        none                                indicates that a track contains audio records
  677. #define    bAMAP    AMAPblok        //    0        FAUD        (S)mapping bits                        bits indicate target tracks
  678. #define    bFF_X     FF_Xblok        //    0        TRAK        none                                indicates that a track contains F/X records
  679. #define    bTREC     TRECblok        //    n        TRAK        (S)clipID,(L)strt,(L)end,sub-blocks    Contains the blocks for a single track item
  680. #define    bRBND     RBNDblok        //    0        TREC        (S)max, RPNT blocks                    [optional] The rubber band info for a track item
  681. #define    bRPNT     RPNTblok        //    0-n        RBND        (L)h, (S)v                            rubber band point
  682. #define    bFXOP     FXOPblok        //    0        TREC        (C)crnr,(C)dir,(S)strt,(S)end,blks    [optional] The options controlling F/X options
  683. #define    bFXDF     FXDFblok        //    0        FXOP        OSType                                the base type of the effect
  684. #define    bEDGE     EDGEblok        //    0        FXOP        (S)thickness, COLR block            [optional] describes edge thickness
  685. #define    bMPNT     MPNTblok        //    0        FXOP        Point                                [optional] reference point for next to types
  686. #define    bSPNT     SPNTblok        //    0        FXOP        Point                                [optional] user specified open point
  687. #define    bEPNT     EPNTblok        //    0        FXOP        Point                                [optional] user specified close point
  688. #define    bOVER     OVERblok        //    0        TREC        (S)type, info blocks                [optional] The parameters for an overlay item
  689. #define    bCOLR     COLRblok        //    0        OVER,FILE    RGBColor                            [optional] key or fill color
  690. #define    bSIMI     SIMIblok        //    0        OVER        (S)similarity                        [optional] similarity value
  691. #define    bBLND     BLNDblok        //    0        OVER        (S)blend                            [optional] blend value
  692. #define    bTHRS     THRSblok        //    0        OVER        (S)threshold                        [optional] threshold value
  693. #define    bCUTO     CUTOblok        //    0        OVER        (S)cutoff                            [optional] cutoff value
  694. #define    bALIA     ALIAblok        //    0        OVER        (S)level                            [optional] anti-aliasing level
  695. #define    bSHAD     SHADblok        //    0        OVER        none                                [optional] if present, shadowing is on
  696. #define    bRVRS     RVRSblok        //    0        OVER        none                                [optional] if present, key is reversed
  697. #define    bGARB     GARBblok        //    0        OVER        (R)ref rect,point blocks            garbage matte points
  698. #define    bPONT     PONTblok        //    0-n        GARB,RBND    Point
  699. #define    bMATI     MATIblok        //    0        OVER        (S)clipID                            [optional] The ID of the clip describing an overlay Matte
  700. #define    bVFLT     VFLTblok        //    0        TREC        sub-blocks                            [optional] followed by individual filter blocks
  701. #define    bAFLT     AFLTblok        //    0        TREC        sub-blocks                            [optional] followed by individual filter blocks
  702. #define    bFILT     FILTblok        //    0-n        VFLT,AFLT    (S)fileID,data block                The (short) fileID, followed by a variable amount of data
  703. #define    bMOTN     MOTNblok        //    0        TREC        (R)ref rect,sub blocks                [optional] A record describing the motion path for a track item
  704. #define    bSMTH     SMTHblok        //    0        MOTN        none                                If present, motion path is smoothed
  705. #define    bMREC     MRECblok        //    0-n        MOTN        (S)zoom,(P)spot,(P)dest[4]            describes each motion point
  706. #define    bDATA     DATAblok        //    0        any            data block                            [optional]generic data block, for storing parameter handles
  707. #define    bCLPB     CLPBblok        //    0        BLOK        clip blocks                            Contains all of the clip blocks
  708. #define    bCLIP     CLIPblok        //    ID        CLPB        (S)fileID,(L)in,(L)out                the descriptive info for a clip
  709. #define    bMARK     MARKblok        //    0-9        CLIP        (L)location                            [optional] For set markers, defines the markers
  710. #define    bLOCK     LOCKblok        //    0        CLIP        none                                [optional] If present, clip has locked aspect
  711. #define    bRATE     RATEblok        //    0        CLIP        (S)rate * 100                        [optional] Defines a rate other than 1.00
  712. #define    bFILB     FILBblok        //    0        BLOK        file blocks                            Contains all of the file blocks
  713. #define    bFILE     FILEblok        //    ID        FILB        info blocks                            the descriptive blocks for a file
  714. #define    bMACS     MACSblok        //    0        FILE        FSSpec                                the mac file spec
  715. #define    bMACP     MACPblok        //    0        FILE        string                                the full mac pathname
  716. #define    bDOSF    DOSFblok        //  0        FILE        string                                the full DOS file and path
  717. #define    bFRMS     FRMSblok        //    0        FILE        (L)#frames                            [optional] number of frames for a file w/content
  718. #define    bVIDI     VIDIblok        //    0        FILE        (L)video frame,(S)depth                [optional] Describes the video portion of the file
  719. #define    bAUDI     AUDIblok        //    0        FILE        (S)aud flags,(L)aud rate            [optional] Describes the audio portion of the file
  720. #define    bTIMC     TIMCblok        //    0        FILE        timecode                            [optional] Specifies the timecode for the first file frame
  721. #define    bTIMB    TIMBblok        //    0        FILE        (L)frame,(C)dropframe,(C)format        [optional] Specifies the binary timecode, as above
  722. #define    bREEL     REELblok        //    0        FILE        (STR)reel name                        [optional] String describing the source reel for the file
  723.  
  724. // These are the structures for the static data for several of the blocks
  725.  
  726. typedef struct {
  727.     long            start;                // starting position for the work area
  728.     long            end;                // ending position for the work area
  729. } Rec_BLOK;
  730.  
  731. typedef struct {
  732.     short            fileID;                // the dependent file ID
  733.     long            in;                    // the IN point within the source material
  734.     long            out;                // the OUT point within the source material minus 1
  735. } Rec_CLIP;
  736.  
  737. typedef struct {
  738.     short            clipID;                // the dependent clip ID
  739.     long            start;                // the clip starting position
  740.     long            end;                // the clip ending position
  741. } Rec_TREC;
  742.  
  743. typedef struct {
  744.     short            zoom;                // zoom factor 1 to 400, 100 is normal
  745.     short            time;                // time location 1 to 1000
  746.     short            rotation;            // rotation factor -360 to 360, 0 is normal
  747.     short            delay;                // delay factor 0 to 100, 0 is normal
  748.     POINT            spot;                // the center point for the image at this point
  749. } Rec_MREC;
  750.  
  751. typedef struct {
  752.     unsigned char    corners;            // the 'corner' flags, one bit each, from the user settings for the effect
  753.     char            direction;            // the direction flag, 0= A-->B, 1=B-->A
  754.     short            startPercent;        // starting percentage times 100
  755.     short            endPercent;            // ending percentage times 100
  756. } Rec_FXOP;
  757.  
  758. typedef struct {
  759.     long            h;
  760.     short            v;
  761. } Rec_RPNT;
  762.  
  763. typedef struct {
  764.     RECT            frame;                // bounding frame for video data
  765.     short            depth;                // bit depth for video data
  766. } Rec_VIDI;
  767.  
  768. typedef struct {
  769.     long    frames;            // binary frame count
  770.     char    dropframe;        // true = DF, false = NDF
  771.     char     format;            // true = NTSC(30), false = PAL(25), 2=Film(24)
  772. } Rec_TIMB;
  773.  
  774. #define    DISSblok FOURCC('D','I','S','S')
  775. #define    TAKEblok FOURCC('T','A','K','E')
  776. #define    WI00blok FOURCC('W','I','0','0')
  777. #define    WI01blok FOURCC('W','I','0','1')
  778. #define    WI02blok FOURCC('W','I','0','2')
  779. #define    WI03blok FOURCC('W','I','0','3')
  780. #define    WI04blok FOURCC('W','I','0','4')
  781. #define    WI05blok FOURCC('W','I','0','5')
  782. #define    WI06blok FOURCC('W','I','0','6')
  783. #define    WI07blok FOURCC('W','I','0','7')
  784. #define    WI08blok FOURCC('W','I','0','8')
  785. #define    WI09blok FOURCC('W','I','0','9')
  786. #define    WI10blok FOURCC('W','I','1','0')
  787. #define    WI11blok FOURCC('W','I','1','1')
  788. #define    WI12blok FOURCC('W','I','1','2')
  789. #define    WI13blok FOURCC('W','I','1','3')
  790. #define    WI14blok FOURCC('W','I','1','4')
  791. #define    WI15blok FOURCC('W','I','1','5')
  792. #define    WI16blok FOURCC('W','I','1','6')
  793.  
  794. // These are the basic effect types, each effect falls back to one of these
  795. #define    fDISS  DISSblok            // cross dissolve
  796. #define    fTAKE  TAKEblok            // 'take' or cut
  797. #define    fWI00  WI00blok            // vertical wipe from the left edge
  798. #define    fWI01  WI01blok            // horizontal wipe from the top edge
  799. #define    fWI02  WI02blok            // vertical wipe from the right edge
  800. #define    fWI03  WI03blok            // horizontal wipe from the bottom edge
  801. #define    fWI04  WI04blok            // diagonal wipe from upper left corner
  802. #define    fWI05  WI05blok            // diagonal wipe from upper right corner
  803. #define    fWI06  WI06blok            // diagonal wipe from lower right corner
  804. #define    fWI07  WI07blok            // diagonal wipe from lower left corner
  805. #define    fWI08  WI08blok            // vertical split wipe
  806. #define    fWI09  WI09blok            // horizontal split wipe
  807. #define    fWI10  WI10blok            // horizontal/vertical split wipe
  808. #define    fWI11  WI11blok            // box wipe out from the center
  809. #define    fWI12  WI12blok            // circular wipe from the center
  810. #define    fWI13  WI13blok            // inset wipe from upper left
  811. #define    fWI14  WI14blok            // inset wipe from upper right
  812. #define    fWI15  WI15blok            // inset wipe from lower right
  813. #define    fWI16  WI16blok            // inset wipe from lower left
  814.  
  815.  
  816. // EDL Export Data Structure
  817.  
  818. typedef struct {
  819.     Handle    dataHandle;            // data handle
  820.     short    timeBase;            // current default timebase
  821.     Ptr        projectName;        // pointer to current project name
  822. } ExportRecord, **ExportHandle;
  823.  
  824. // Selector messages
  825. enum {
  826.     exExecute = 0,
  827.     exTrue30fps,
  828. };
  829.  
  830.  
  831. // 'EDLE'
  832. //#define EDLEtype    0x45444c45L
  833. //#define TEXTtype    0x54455854L
  834.  
  835.  
  836.  
  837. ///-----------
  838. enum{
  839.     openErr = -23,                /*I/O System Errors*/
  840.     nsvErr = -35,                 /*no such volume*/
  841.     ioErr = -36,                  /*I/O error (bummers)*/
  842.     eofErr = -39,                 /*End of file*/
  843.     tmfoErr = -42,                /*too many files open*/
  844.     fnfErr = -43,                 /*File not found*/
  845.     wPrErr = -44,                 /*diskette is write protected.*/
  846.     dupFNErr = -48,               /*duplicate filename (rename)*/
  847.     permErr = -54,                /*permissions error (on file open)*/
  848.     fsRnErr = -59,                /*file system internal error:during rename the old entry was deleted but could not be restored.*/
  849.     memFullErr = -108,            /*Not enough room in heap zone*/
  850.     nilHandleErr = -109,          /*Master Pointer was NIL in HandleZone or other*/
  851.     dirNFErr = -120,              /*Directory not found*/
  852.     badExtResource = -185,        /*extended resource has a bad format.*/
  853.     resNotFound = -192,           /*Resource not found*/
  854.     fBsyErr = -47,                /*File is busy (delete)*/
  855.     memWZErr = -111
  856. };
  857.  
  858. #define    VFlttype    0x56466c74L            // This indicates an audio filter
  859. #define    AFlttype    0x41466c74L            // This indicates an audio filter
  860. #define    SPFXtype    0x53504658L
  861. #define PICTtype    0x50494354L
  862. #define    PICStype    0x50494353L
  863. #define    DRAWtype    0x44524157L
  864.  
  865. //══════════════════════════════════════
  866. // XREF structures - used to translate a file type the HDLR or Draw type
  867.  
  868. #define    xfCanOpen        0x8000
  869. #define    xfCanImport        0x4000
  870. #define    xfCanReplace    0x2000
  871. #define    xfUsesFiles        0x1000
  872.  
  873. #define    xfIsEffect        0x0080
  874. #define    xfIsAFilter        0x0040
  875. #define    xfIsVFilter        0x0020
  876. #define    xfIsStill        0x0010
  877. #define    xfIsMovie        0x0008
  878. #define    xfIsSound        0x0004
  879. #define    xfIsAnimation    0x0002
  880.  
  881. #define    xfTypes            0x03FF
  882.